<template>
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      :collapse="false"
    >
      <el-sub-menu index="1" >
        <template #title>
          <el-icon><location /></el-icon>
          <span>用户</span>
        </template>
        <el-menu-item-group>
        <template></template>
          <el-menu-item @click="goLink('1-1')" index="1-1">绑定个人信息</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
      <el-sub-menu index="2">
        <template #title>
          <el-icon><location /></el-icon>
          <span>刷课</span>
        </template>
        <el-menu-item-group>
        <template></template>
          <el-menu-item @click="goLink('2-1')" index="2-1">全部课信息</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
      <el-sub-menu index="3">
        <template #title>
          <el-icon><location /></el-icon>
          <span>注销</span>
        </template>
        <el-menu-item-group>
        <template></template>
          <el-menu-item @click="goLink('3-1')" index="3-1">退出登录</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
    </el-menu>
  </template>
  
  <script lang="ts" setup>
  import { ref } from 'vue'
  import {
    Document,
    Menu as IconMenu,
    Location,
    Setting,
  } from '@element-plus/icons-vue'
  import { ElMessage } from 'element-plus'

  const router = useRouter()
  const goLink = (path: string)=>{
    switch (path) {
      case "1-1":
        router.push({name: "bindpersonal"})
      break;
      case "2-1":
        router.push({name: "allClassInfo"})
      break;
      case "3-1":
        localStorage.removeItem("sysInfo")
        localStorage.removeItem("token")
        localStorage.removeItem("userInfo")
        router.push({name: "login"})
        ElMessage({
          message: "注销成功",
          type: 'success',
        })
      break;
      default:
        break;
    }

  }

 
  </script>
  
  <style>
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
  </style>